import java.util.Scanner;

public class HJ17 {//坐标移动,思路设计方法忽略非法命令，判断合法命令第一位决定后续数据部分处理思路
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String Str = in.nextLine();
        String[] orders = Str.split(";");
        int x = 0, y = 0;
        for (String order :orders){
            if (isValidInstruction(order)){
                char direction = order.charAt(0);
                int distance = Integer.parseInt(order.substring(1,order.length()));
                switch (direction){
                    case 'A':
                        x -= distance;
                        break;
                    case 'D':
                        x += distance;
                        break;
                    case 'W':
                        y += distance;
                        break;
                    case 'S':
                        y -= distance;
                        break;
                }
            }
        }
        System.out.println(x+","+y);
    }
    private static boolean isValidInstruction(String order){
        if (order.length() < 2 || order.length() > 3){
            return false;
        }
        char direction = order.charAt(0);
        if (direction != 'A' && direction != 'D' && direction != 'W' && direction != 'S') {
            return false;
        }
        try {
            int distance = Integer.parseInt(order.substring(1, order.length()));
            if (distance < 1 || distance > 99) {
                return false;
            }
        } catch (NumberFormatException e) {
            return false;
        }
        return true;
    }
}
